package com.xm.common.entity.vo.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@Data
public class MonitorResponse {

    private Integer clientId;

    private String metricType; // CPU/MEMORY/DISK/NETWORK/DISK-IO

    private String period;

    // DISK专用
    private List<CommonData> commonData;

    // DISK-IO专用
    private List<DiskData> disks;

    // NETWORK专用
    private List<NetworkData> network;

    @Data
    @AllArgsConstructor
    public static class CommonData {
        @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "GMT+8")
        private LocalDateTime timestamp;
        // CPU/MEMORY/DISK专用
        private Double value;
    }

    @Data
    @AllArgsConstructor
    public static class DiskData {
        @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "GMT+8")
        private LocalDateTime timestamp;
        private Double read;
        private Double write;
    }

    @Data
    @AllArgsConstructor
    public static class NetworkData {
        @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "GMT+8")
        private LocalDateTime timestamp;
        private Double upload;
        private Double download;
    }
}
